package com.limbo.showapp.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.bumptech.glide.Glide;
import com.limbo.showapp.MyApplication;
import com.limbo.showapp.R;
import com.limbo.showapp.base.SimpleBaseActivity;
import com.limbo.showapp.constant.AppConstant;
import com.limbo.showapp.widget.SimpleOptionView;

import java.util.HashMap;
import java.util.LinkedHashMap;

import cn.jzvd.JZVideoPlayer;
import cn.jzvd.JZVideoPlayerStandard;

/**
 * 暂时未用上
 * Created by wangqi on 2018/9/9.
 */

public class VideoDisplayActivity extends SimpleBaseActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_video_display);

        SimpleOptionView simpleTileView = findViewById(R.id.simpleTileView);
        JZVideoPlayerStandard videoplayer = findViewById(R.id.videoplayer);
        Glide.with(this).load(AppConstant.Url.BASE_URL + "mimi_php/picture/brid_qinglv/1.jpg")
                .into(videoplayer.thumbImageView);
        LinkedHashMap map = new LinkedHashMap();
        String proxyUrl = MyApplication.getProxy(this).
                getProxyUrl(AppConstant.Url.BASE_URL + "mimi_php/video/brid.mp4"); // 这是各个清晰度URL
        map.put("高清", proxyUrl);//这里是边播边缓存
//         map.put("标清",proxyUrl);
//         map.put("普清", proxyUrl);
        Object[] objects = new Object[3];
        objects[0] = map;
        objects[1] = false;//looping //这里是重复播放的标志
        objects[2] = new HashMap<>();


//        videoplayer.setUp(objects, 0,
//                JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "小鸟酱");

        JZVideoPlayerStandard.startFullscreen(this, JZVideoPlayerStandard.class,
                AppConstant.Url.BASE_URL + "mimi_php/video/brid2.mp4", "小鸟酱");

    }

    @Override
    protected int getLayoutId() {
        return 0;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    public void onBackPressed() {
        if (JZVideoPlayer.backPress()) {
            return;
        }
        super.onBackPressed();
    }

    @Override
    protected void onPause() {
        super.onPause();
        JZVideoPlayer.releaseAllVideos();
    }

    public static void OpenActivity(Context context) {
        context.startActivity(new Intent(context, VideoDisplayActivity.class));
    }
}
